home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / N-P / OmniScript 2.0.1 / Examples / Core Apple Open Event next >
Encoding:
Text File  |  1993-09-30  |  2.0 KB  |  96 lines  |  [TEXT/ExPr]

  1. * This script creates the standard Apple event to open documents
  2. * The launch or aesend command can be used here to send the event
  3. *
  4. a = "'Init List' 'Add File' '(-' 'Send' 'Launch'"
  5. lval a,$Control
  6. menu new,20,0,$Control
  7. menuscript 20,Control
  8.  
  9. a = "'Signature' 'Application' 'PPC Browser'"
  10. lval a,$Target
  11. menu new,21,0,$Target
  12. menuscript 21,Target
  13.  
  14. $TargetSet = 0
  15. $List = 0
  16. $sign = '****'
  17.  
  18. disp 'To use this script select the target using Target menu'
  19. disp '  The target is specified by selecting one of the following:'
  20. disp '    an application (used only with launch)'
  21. disp '    a 4 character application signature (used with launch or send)'
  22. disp '    a target chosen by PPC Browser (used only with send)'
  23. disp '  The files to be sent are chosen using "Add File" from the Control menu'
  24. disp '    This list is initialized by choosing "Init List" from the Control menu'
  25. disp '  Send the event by choosing "Send" or "Launch"  from the Control menu'
  26.  
  27. script Control
  28. if #arg(2) = 1
  29.     $List = 0
  30. else if #arg(2) = 2
  31.     get a
  32.     test (#ret) exit
  33.     inc $List
  34.     alias $List[$List] = ,a
  35. else
  36.     if $TargetSet = 0
  37.         disp 'No Target'
  38.         exit
  39.     else if $List = 0
  40.         disp 'No Files Selected'
  41.         exit
  42.     else if #arg(2) = 4
  43.         if $TargetSet = 2
  44.             disp 'Cannot use Application target with Send'
  45.             exit
  46.         end
  47.         exec BuildEvent
  48.         aesend
  49.     else 
  50.         if $TargetSet = 3
  51.             disp 'Cannot use PPC Browser target with Launch'
  52.             exit
  53.         end
  54.         path x,
  55.         file 0,$Appl
  56.         $sign = #file(cre)
  57.         exec BuildEvent
  58.         if $TargetSet = 1
  59.             launch sign=$sign,aevt
  60.         else
  61.             launch file=$Appl,aevt
  62.         end
  63.     end
  64. end
  65.  
  66. script Target
  67. if #arg(2) = 1
  68.     do
  69.         accept $sign,'Enter 4 character application signature'
  70.         test (#ret) exit
  71.         test (#len($sign) = 4) quit
  72.     end
  73. else if #arg(2) = 2
  74.     get $Appl,'APPLadrp'
  75.     test (#ret) exit
  76.     path x = ,
  77.     disp 'target application is '#path':'$Appl
  78. else
  79.     aetarget $Targ
  80.     test (#ret) exit
  81. end
  82. $TargetSet = #arg(2)
  83.  
  84. script BuildEvent
  85. if $TargetSet = 3
  86.     aenew 'aevt','odoc',targ=$Targ
  87. else
  88.     aenew 'aevt','odoc',sign=$sign
  89. end
  90. aelistnew
  91. i = 0
  92. do while i < $List
  93.     inc i
  94.     aelistadd 'alis',$List[i]
  95. end
  96. aeadd '----','list'